home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Business / Helpme / _SETUP.1 / helpme.dxr / problemsolving_23_Rollover Cursor Change.ls < prev    next >
Encoding:
Text File  |  1999-11-12  |  4.4 KB  |  130 lines

  1. property spriteNum, myCursorType, myBuiltInCursor, myCursorMember, myCustomCursor, myCustomMask, mySprite, mySavedCursor
  2.  
  3. on beginSprite me
  4.   SetSpriteCursor(me)
  5. end
  6.  
  7. on endSprite me
  8.   mySprite.cursor = mySavedCursor
  9. end
  10.  
  11. on SetSpriteCursor me
  12.   if spriteNum < 1 then
  13.     if the runMode = "Author" then
  14.       ErrorAlert(me)
  15.     end if
  16.   end if
  17.   mySprite = sprite(me.spriteNum)
  18.   mySavedCursor = mySprite.cursor
  19.   if voidp(myCursorType) then
  20.     mySprite.cursor = myBuiltInCursor
  21.     exit
  22.   end if
  23.   case myCursorType of
  24.     "Built-in cursor":
  25.       mySprite.cursor = myBuiltInCursor
  26.     "Cursor member":
  27.       myCursorMember = value(myCursorMember)
  28.       cursorList = [myCursorMember.number]
  29.       mySprite.cursor = cursorList
  30.     "1 bit bitmap":
  31.       myCustomCursor = value(myCustomCursor)
  32.       cursorList = [myCustomCursor.number]
  33.       if myCustomMask <> "no mask" then
  34.         myCustomMask = value(myCustomMask)
  35.         cursorList.append(myCustomMask.number)
  36.       end if
  37.       mySprite.cursor = cursorList
  38.   end case
  39. end
  40.  
  41. on ErrorAlert me
  42.   behaviorName = string(me)
  43.   delete word 1 of behaviorName
  44.   delete char -30001 of behaviorName
  45.   delete char -30001 of behaviorName
  46.   alert("BEHAVIOR ERROR: Frame " & the frame & ", Sprite " & me.spriteNum & RETURN & RETURN & "Behavior " & behaviorName & "has been attached to the frame." & RETURN & RETURN & "It will have no effect, and should be removed from the behavior channel.")
  47. end
  48.  
  49. on getPropertyDescriptionList me
  50.   if not (the currentSpriteNum) then
  51.     exit
  52.   end if
  53.   propertyDescriptionList = [:]
  54.   cursorTypes = []
  55.   cursorMembersList = GetCursorMembers(me)
  56.   cursorBitmapsList = GetCursorBitmaps(me)
  57.   cursorMasksList = duplicate(cursorBitmapsList)
  58.   cursorMasksList.addAt(1, "no mask")
  59.   cursorMembers = cursorMembersList.count()
  60.   bitmapCursors = cursorBitmapsList.count()
  61.   if cursorMembers then
  62.     cursorTypes.append("Cursor member")
  63.   end if
  64.   if bitmapCursors then
  65.     cursorTypes.append("1 bit bitmap")
  66.   end if
  67.   if cursorTypes.count() then
  68.     cursorTypes.addAt(1, "Built-in cursor")
  69.     propertyDescriptionList.addProp(#myCursorType, [#comment: "CHOICE OF TYPE - Use which type of cursor?", #format: #string, #range: cursorTypes, #default: cursorTypes[1]])
  70.     propertyDescriptionList.addProp(#myBuiltInCursor, [#comment: "CHOICE OF CURSOR   -               Built-in cursor:", #format: #cursor, #default: 280])
  71.   else
  72.     return [#myBuiltInCursor: [#comment: "Use which cursor?", #format: #cursor, #default: 280]]
  73.   end if
  74.   if cursorMembers then
  75.     propertyDescriptionList.addProp(#myCursorMember, [#comment: "-             Cursor member:", #format: #member, #range: cursorMembersList, #default: cursorMembersList[1]])
  76.   end if
  77.   if bitmapCursors then
  78.     propertyDescriptionList.addProp(#myCustomCursor, [#comment: "-   1 bit bitmap (image):", #format: #bitmap, #range: cursorBitmapsList, #default: cursorBitmapsList[1]])
  79.     propertyDescriptionList.addProp(#myCustomMask, [#comment: "1 bit bitmap   (mask):", #format: #bitmap, #range: cursorMasksList, #default: cursorMasksList[1]])
  80.   end if
  81.   return propertyDescriptionList
  82. end
  83.  
  84. on GetCursorMembers me
  85.   cursorMembersList = []
  86.   maxCastLib = the number of castLibs
  87.   repeat with theCastLib = 1 to maxCastLib
  88.     maxMember = the number of castMembers of castLib theCastLib
  89.     repeat with memberNumber = 1 to maxMember
  90.       theMember = member(memberNumber, theCastLib)
  91.       if theMember.type = #cursor then
  92.         if theMember.name = EMPTY then
  93.           cursorMembersList.append(theMember)
  94.           next repeat
  95.         end if
  96.         cursorMembersList.append(theMember.name)
  97.       end if
  98.     end repeat
  99.   end repeat
  100.   return cursorMembersList
  101. end
  102.  
  103. on GetCursorBitmaps me
  104.   cursorBitmapsList = []
  105.   maxCastLib = the number of castLibs
  106.   repeat with theCastLib = 1 to maxCastLib
  107.     maxMember = the number of castMembers of castLib theCastLib
  108.     repeat with memberNumber = 1 to maxMember
  109.       theMember = member(memberNumber, theCastLib)
  110.       if theMember.type = #bitmap then
  111.         if theMember.depth > 1 then
  112.           next repeat
  113.         end if
  114.         if theMember.width > 20 then
  115.           next repeat
  116.         end if
  117.         if theMember.height > 20 then
  118.           next repeat
  119.         end if
  120.         if theMember.name = EMPTY then
  121.           cursorBitmapsList.append(theMember)
  122.           next repeat
  123.         end if
  124.         cursorBitmapsList.append(theMember.name)
  125.       end if
  126.     end repeat
  127.   end repeat
  128.   return cursorBitmapsList
  129. end
  130.